package com.jcompressor.maven;

import java.util.List;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

public abstract class AbstractJcompressorMojo extends AbstractMojo {
	
	/**
	 * @parameter expression="${project.name}"
	 */
	private String projectName;
	
	/**
	 * @parameter expression="${project.artifactId}"
	 */
	private String projectArtifactId;
	
	/**
	 * @parameter expression="${project.version}"
	 */
	private String projectVersion;
	
	/**
	 * @parameter expression="${basedir}"
	 */
	private String projectBaseDirectory;
	
	/**
	 * @parameter expression="${project.build.directory}"
	 */
	private String projectBuildDirectory;
	
	/**
	 * @parameter expression="${build.projectConfig}"
	 */
	private String projectConfig;
	
	/**
	 * @parameter
	 */
	private List<String> projects;
	
	@Override
	public abstract void execute() throws MojoExecutionException, MojoFailureException;
	
	public final String getProjectName() {
		return this.projectName;
	}
	
	public final String getProjectArtifactId() {
		return this.projectArtifactId;
	}
	
	public final String getProjectVersion() {
		return this.projectVersion;
	}
	
	public final String getProjectBaseDirectory() {
		return this.projectBaseDirectory;
	}
	
	public final String getProjectBuildDirectory() {
		return this.projectBuildDirectory;
	}
	
	public final String getProjectConfig() {
		return this.projectConfig;
	}
	
	public final List<String> getProjects() {
		return this.projects;
	}
	
	public final boolean hasProjects() {
		if (this.getProjects() == null) {
			return false;
		}
		
		return (this.getProjects().size() > 0);
	}
	
}